var api = require('../../utils/api.js');
var app = getApp();
Page({
    data: {
        banner:[],
        info:'',
        lists:[]
    },
    onLoad() {
        

    },
    onShow() {
        
        var that=this;
        api.post({
            url: 'index/getbanner',
            data: {},
            success: data => {
                that.setData({
                    banner:data.data
                })
            }
        })
        api.post({
            url: 'index/getcompinfo',
            data: {},
            success: data => {
                that.setData({
                    info:data.data
                })
            }
        })

        api.post({
            url: 'index/getdongtai',
            data: {},
            success: data => {
                that.setData({
                    lists:data.data
                })
            }
        })
    },

    previewImage(e) {
        wx.previewImage({
            current: '', // 当前显示图片的http链接
            urls: [e.currentTarget.dataset.previewUrl] // 需要预览的图片http链接列表
        });

    },
    onShareAppMessage() {
        return {
            title: '巨量膜方',
            path: '/pages/index/index'
        }
    },
    seeinfobyid(ret){
        console.log(ret);
        var id=ret.currentTarget.dataset.id;

        wx.navigateTo({
          url: '/pages/article/article?id='+id
        })
    },

    seemorelist(){
        wx.navigateTo({
          url: '/pages/index/lists',
        })
    },
    gomy(){
        wx.switchTab({
          url: '/pages/my/my',
        })
    },
    callphone(){

        var info=this.data.info;

        wx.makePhoneCall({
          phoneNumber: info.mobile
        })

    }

});
